Skip to content

Databento two-stage price producer + per-symbol provider selection (ADR-0006)#39

Merged
mspinola merged 3 commits into
mainfrom
adr-0006-databento-producer
Jul 24, 2026
Merged

Databento two-stage price producer + per-symbol provider selection (ADR-0006)#39
mspinola merged 3 commits into
mainfrom
adr-0006-databento-producer

Conversation

@mspinola

Copy link
Copy Markdown
Owner

Implements ADR-0006 so a server without Norgate can build the price store from Databento. Consumers (cotmetrics, cot-analyzer) are unchanged — they still read the store.

Per-symbol provider selection

  • databento capability mapping + optional price_source override in the registry.
  • resolve_source() / default_price_source() (COTDATA_PRICE_SOURCE): deployment default + capability + yfinance fallback. The yfinance producer is now deployment-aware.

Databento producer (two stages)

  • --ingest-databento (paid): raw .n.0/.n.1 ohlcv-1d + statistics into an append-only, resumable raw store (producer-internal).
  • --build-databento (free): additive back-adjustment matching Norgate's method (gap = n1 − n0 on each roll date, shifted back-to-front so the newest segment stays at real prices), settlement close (stat_type 3), OI (stat_type 9). Roll detection keys on instrument_id (the symbol column is a constant continuous alias).

Validation & docs

  • scripts/validate_databento_vs_norgate.py parity harness (unit-tested on synthetic frames).
  • README: cross-platform build runbook + Linux cron section.

Verified on live ES/CL/GC (65/80/235 rolls; daily changes preserved off-seam, newest segment anchored to real prices, no non-positive closes). Also carries the CFTC format='mixed' date-parse hardening + a future-date sanity guard.

cotdata: 110 tests green.

🤖 Generated with Claude Code

mspinola and others added 3 commits July 24, 2026 16:42
Implements ADR-0006 (one price provider per symbol) so a server without Norgate can build the price store from Databento.

- registry: databento capability mapping + optional price_source override; resolve_source()/default_price_source() (COTDATA_PRICE_SOURCE); softs/lumber/MSCI marked non-GLBX with Yahoo fallback tickers.
- databento provider: two-stage ingest (paid, append-only raw store, resumable) + build (free, additive back-adjustment; roll detection via instrument_id; settlement stat_type 3; OI stat_type 9).
- yfinance: deployment-aware target selection via resolve_source.
- update.py: --ingest-databento / --build-databento flags.
- scripts/validate_databento_vs_norgate.py: Norgate-parity harness.
- README + pyproject docs; 16 new/updated tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mspinola
mspinola merged commit 9aee53d into main Jul 24, 2026
5 checks passed
@mspinola
mspinola deleted the adr-0006-databento-producer branch July 24, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant